from mall import settings
from itsdangerous import TimedJSONWebSignatureSerializer as serializer

def generate_openid_token(openid):
    s=serializer(secret_key=60*10,expire_in=settings.SECRET_KEY)
    data={
        "openid":openid
    }
    token=s.dumps(data)
    return token.decode()







# from mall import settings
# from itsdangerous import TimedJSONWebSignatureSerializer  as serializer

# 加密
# s=serializer(expires_in=60*10,secret_key=settings.SECRET_KEY)
# s=serializer(expires_in=1,secret_key=settings.SECRET_KEY)
#
#
#
# data={
#     'openid':'1234567'
# }
# token=s.dumps(data)
# # 解密
# data2=s.loads(token)